﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="HandleError.cs" company="ecblog.codeplex.com">
//   emrecoskun.net - ibrahimatay.com
// </copyright>
// <summary>
//   The handle error attribute
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace EcBlog.Filters
{
    using System.ComponentModel.Composition;
    using System.Web.Mvc;

    using Elmah;

    /// <summary>
    /// The handle error attribute
    /// </summary>
    [Export]
    public class HandleErrorAttribute : System.Web.Mvc.HandleErrorAttribute
    {
        /// <summary>
        /// Called when [exception].
        /// </summary>
        /// <param name="context">The context.</param>
        public override void OnException(ExceptionContext context)
        {
            base.OnException(context);
            if (context.ExceptionHandled)
            {
                ErrorSignal.FromCurrentContext().Raise(context.Exception);
            }
        }
    }
}